Skip to content

Upgrade OpenTelemetry to 1.58.0 / 2.24.0#4606

Draft
Copilot wants to merge 13 commits intomainfrom
copilot/update-opentelemetry-versions
Draft

Upgrade OpenTelemetry to 1.58.0 / 2.24.0#4606
Copilot wants to merge 13 commits intomainfrom
copilot/update-opentelemetry-versions

Conversation

Copy link
Contributor

Copilot AI commented Jan 28, 2026

Upgrades OpenTelemetry SDK from 1.55.0 to 1.58.0 and Instrumentation from 2.21.0 to 2.24.0. Version 2.24.0 introduced breaking internal API changes and a new io.opentelemetry.common package that caused classloader conflicts and initialization timing issues.

Classloader Conflict Resolution

The new io.opentelemetry.common.ComponentLoader class appears in both upstream javaagent (pre-shaded) and our transitive dependencies. Including both creates loader constraint violations:

java.lang.LinkageError: loader constraint violation in interface itable initialization:
...different Class objects for ComponentLoader in AgentClassLoader vs bootloader

Fix: Exclude io.opentelemetry:opentelemetry-common from our javaagent libs since upstream already provides it. Also exclude already-shaded upstream classes from relocation to prevent double-shading.

API Migrations

AgentInstrumentationConfig removed

Upstream removed this internal API. Instrumentation modules now load before SDK autoconfiguration, preventing access to properties through DeclarativeConfigUtil. Switched to system property access with AiConfigCustomizer setting properties via System.setProperty():

// MethodInstrumentationModule, AzureMonitorRegistryConfig
String config = System.getProperty("applicationinsights.internal.methods.include");

LoggingCustomizer.init() signature changed

Now takes no parameters instead of EarlyInitAgentConfig.

GlobalOpenTelemetry.getPropagators() unreliable

Changed Azure Functions instrumentation to use W3CTraceContextPropagator.getInstance() directly.

Initialization Timing

Browser SDK snippet initialization triggered GlobalOpenTelemetry.get() during SDK autoconfiguration, before GlobalOpenTelemetry.set() was called. Moved snippet initialization from SecondEntryPoint.customize() to AfterAgentListener.afterAgent().

Files Modified

  • dependencyManagement/build.gradle.kts - version bumps
  • agent/agent/build.gradle.kts - opentelemetry-common exclusion
  • buildSrc/.../ai.shadow-conventions.gradle.kts - relocation exclusions for shaded classes
  • agent/agent-tooling/.../AiConfigCustomizer.java - system property setting
  • agent/agent-tooling/.../FirstEntryPoint.java - LoggingCustomizer API
  • agent/agent-tooling/.../SecondEntryPoint.java - removed early snippet init
  • agent/agent-tooling/.../AfterAgentListener.java - deferred snippet init
  • agent/instrumentation/methods/.../MethodInstrumentationModule.java - system property config
  • agent/instrumentation/micrometer-1.0/.../AzureMonitorRegistryConfig.java - system property config
  • agent/instrumentation/azure-functions/.../InvocationInstrumentation.java - direct propagator

Warning

Firewall rules blocked me from connecting to one or more addresses (expand for details)

I tried to connect to the following addresses, but was blocked by firewall rules:

  • agent.azureserviceprofiler.net
    • Triggering command: /opt/java/openjdk/bin/java java -jar RuntimeAttachWithDelayedConnectionString-3.7.7-SNAPSHOT.jar delete (dns block)
    • Triggering command: /opt/java/openjdk/bin/java java -jar RuntimeAttachWithDelayedConnectionString-3.7.7-SNAPSHOT.jar (dns block)

If you need me to access, download, or install something from one of these locations, you can either:

Original prompt

val otelSdkVersion = "1.58.0"
val otelInstrumentationAlphaVersion = "2.24.0-alpha"
val otelInstrumentationVersion = "2.24.0"


💡 You can make Copilot smarter by setting up custom instructions, customizing its development environment and configuring Model Context Protocol (MCP) servers. Learn more Copilot coding agent tips in the docs.

Copilot AI and others added 3 commits January 28, 2026 19:58
…rors)

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title [WIP] Update OpenTelemetry SDK and instrumentation versions Upgrade OpenTelemetry to 1.58.0 / 2.24.0 Jan 28, 2026
Copilot AI requested a review from xiang17 January 28, 2026 20:19
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title Upgrade OpenTelemetry to 1.58.0 / 2.24.0 Add system property fallback to DeclarativeConfigUtil config access Jan 28, 2026
Copilot AI and others added 2 commits February 4, 2026 23:27
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
After OpenTelemetry upgrade to 2.24.0, GlobalOpenTelemetry.getPropagators()
doesn't work correctly in test environments. Changed to use
W3CTraceContextPropagator.getInstance() directly for context extraction.

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title Add system property fallback to DeclarativeConfigUtil config access Fix Azure Functions context propagation after OpenTelemetry 2.24.0 upgrade Feb 4, 2026
Copilot AI and others added 2 commits February 5, 2026 00:31
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
The upstream OpenTelemetry javaagent already includes io.opentelemetry.common
classes (properly shaded). Our build was including the same classes, causing
classloader conflicts. Added exclusion to prevent double inclusion.

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI changed the title Fix Azure Functions context propagation after OpenTelemetry 2.24.0 upgrade Upgrade OpenTelemetry to 1.58.0 / 2.24.0 Feb 5, 2026
AiConfigCustomizer properties need to be accessible by instrumentation modules
that load early. Setting them as system properties ensures they're available
through the System.getProperty() fallback mechanism.

Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Copilot AI and others added 2 commits February 5, 2026 23:23
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Co-authored-by: xiang17 <9310587+xiang17@users.noreply.github.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants